package cn.usian.pricingstrategy.coefficient.controller;

import cn.usian.pojo.Result;
import cn.usian.pojo.pricingstrategy.coefficient.PricingSpecialTimeSlot;
import cn.usian.pricingstrategy.coefficient.service.ITimeSlotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/timeSlot")
public class TimeSlotController {
    @Autowired
    private ITimeSlotService timeSlotService;

    @GetMapping("/list")
    public Result list() {
        return Result.ok(timeSlotService.list());
    }

    @PostMapping("/save")
    public Result save(@RequestBody List<PricingSpecialTimeSlot> pricingSpecialTimeSlot) {
        return Result.ok(timeSlotService.save(pricingSpecialTimeSlot));
    }

    @GetMapping("/findById/{id}")
    public Result findById(@PathVariable long id) {
        return Result.ok(timeSlotService.findById(id));
    }

    @PostMapping("/delete/{id}")
    public Result delete(@PathVariable long id) {
        return Result.ok(timeSlotService.delete(id));
    }

}
